var dtree;
var $;
var table;
var layer;
var form;
layui.extend({
    dtree:'../layui/layui_ext/dtree/dtree'
}).use(['dtree','table','element','layer'],function(){
    dtree=layui.dtree;
    $=layui.jquery;
    table=layui.table;
    layer=layui.layer;
    form=layui.form;


    //ztree
    setDtree();
    function setDtree(){
        $.ajax({
            url:"/SyteacherSelController/seCurriculumTree",
            type:"post",
            dataType:"json",
            data:[],
            success:function(data){
                DtreeView(data.data);
            }
        })
    }
    function DtreeView(data){


        $(function(){
            //点击节点获取值
            function zTreeOnClick(event, treeId, treeNode) {
                var id=treeNode.id;
                var name=treeNode.name;
                parent.$("#courseCatoryId").val(id);
                parent.$("#courseCatory").val(name);
                parent.$("#ForumuserName").val(name);
                var layer_2=parent.layer_2;
                layer_2.close(layer_2.index);
                return false;
            };

            var setting={
                callback: {
                    onClick: zTreeOnClick,
                },
                view: {
                    showIcon: false,
                },
            };

            var zTreeNodes=data;
            var city = $.fn.zTree.init($("#tree"), setting, zTreeNodes);
        });
    }




})
